import java.util.Arrays;


public class Test {
	double aX,aY,cX,cY,p1,p2,h,j,z,k,n,y,x,a,b;
	public Dot2 getXY(double aX,double aY,double cX,double cY,double p1,double p2){
		
		
		if((aY==cY)&&(aX!=cX)){
			y = aY;
			if(cX>aX){
				
			 x = aX+p1;
			 
			}else{
				
			 x = aX-p1;
				
			}
			
			
		}else if((aX==cX)&&(aY!=cY)){
			x = aX;
			if(cY>aY){
				
			 y = aY+p1;
			}else{
				
			 y = aY-p1;
				
			}
			
			
		}else if((aX==cX)&&(aY==cY)){
			
			x= aX;
			y = aY;
		}else{
			
			h = aX*aX+ aY*aY;
			j = cY*cY+cX*cX ;
			z = p1*p1 - p2*p2;
			a = 2*cX -2*aX; 
			b= 2*cY-2*aY ; 
			 k =(cY-aY)/(cX-aX);
			n = cY - k*cX;
			x = (z+j-h-n*b)/(k*b+a);
			y=((z+j-h-n*b)/(k*b+a))*k +n;
		}
		
		
		
		
		return new Dot2((int)x, (int)y); 
		
		

	}
	
public static void main(String[] args) {
	
	Test test = new Test();
	System.out.println(test.getXY(1, 1, 5, 5,Math.sqrt(2), Math.sqrt(18)));
//System.out.println(Math.sqrt(2));
	
}

}

class Dot2{
	
	private int x;
	private int y;
	
	
	public Dot2() {
		
	}
	
	
	public Dot2(int x, int y) {

		this.x = x;
		this.y = y;
	}


	public int getX() {
		return x;
	}
	public void setX(int x) {
		this.x = x;
	}
	public int getY() {
		return y;
	}
	public void setY(int y) {
		this.y = y;
	}
	@Override
	public String toString() {
		return "dot [x=" + x + ", y=" + y + "]";
	}
	
	
	
	
	
}
